<template>
  <div>
    <div class="center">
      <div class="hander">修改套餐</div>
      <div class="conlist">
          <modifyList 
            :goodsPackageBase="this.goodsPackageBase" 
            :goodsPackageRecommends="this.goodsPackageRecommends"
            @research="gitInitData"
          >
          </modifyList>
          <calucation
            :goodsPackageDetails="this.goodsPackageDetails"
            :goodsPkgDiscountPriceDTO="this.goodsPkgDiscountPriceDTO"
            @research="gitInitData"
          ></calucation>
          <imgAdd
            :goodsPackageAttaches="this.goodsPackageAttaches"
            :goodsPackageInventories="this.goodsPackageInventories"
            @research="gitInitData"
          ></imgAdd>
      </div>
    </div>
  </div>
</template>
<script>
import modifyList from "./modifyList.vue";
import calucation from './calculation.vue';
import imgAdd from './imgAdd.vue';
export default {
  data() {
    return {
      goodsPackageBase: {},
      goodsPackageRecommends: [],
      goodsPackageDetails: [],
      goodsPkgDiscountPriceDTO: [],
      goodsPackageAttaches: [],
      goodsPackageInventories: []
    };
  },
  components: {
    modifyList,
    calucation,
    imgAdd
  },
  activated() {
    this.gitInitData()
  },
  methods: {
    async gitInitData() { // 回显数据
      const { data } = await this.$http({
        url: '/hssgoodsadmin/serviceGoodsPkg/getGoodsPkg',
        params: {
          goodsPackageCode: this.$route.query.goodsPackageCode
        }
      })
      const { 
        goodsPackageBase, 
        goodsPackageRecommends,
        goodsPackageDetails,
        goodsPkgDiscountPriceDTO,
        goodsPackageAttaches,
        goodsPackageInventories
      } = data
      this.goodsPackageBase = goodsPackageBase
      this.goodsPackageRecommends = goodsPackageRecommends
      this.goodsPackageDetails = goodsPackageDetails
      this.goodsPkgDiscountPriceDTO = goodsPkgDiscountPriceDTO
      this.goodsPackageAttaches = goodsPackageAttaches
      this.goodsPackageInventories = goodsPackageInventories
    }
  },
};
</script>
<style scoped>
.conlist {
  background-color: #f5f5f5;
  padding: 10px;

  box-sizing: border-box;
  
  border-radius: 8px;
}
</style>